package day10;

import java.util.Scanner;

/**
 * In a BG (dinner gathering) for ZCMU ACM team,
 * the coaches wanted to count the number of people present at the BG.
 * They did that by having the waitress take a photo for them. 
 * Everyone in the photo, no one is blocked by others. 
 * Each person in the photo has the same posture.
 * After some preprocessing, the photo was converted into a H×W character matrix,
 * Thus a person in this photo is represented by the diagram in the following three lines:
 * .O.
 * /|\
 * (.)
 * Given the character matrix, the coaches want you to count the number of people in the photo. Note that if something is partly blocked in the photo, only part of the above diagram will be presented in the character matrix,good luck to you.
 * @author chenxiaokang
 *
 */
public class Ques1927 {
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		String[] s = new String[300];
		
		while(scan.hasNext()){
			int n = 0;
			int m = 0;
			int sum = 0;
			n = scan.nextInt();
			m = scan.nextInt();
			for(int i = 0;i < n;i++){
				s[i] = scan.next();
			}
			for(int i = 0;i < n;i ++){
				for(int j = 0;j < m;j ++){
					if((s[i].charAt(j) == 'O') && ((s[i+1].charAt(j - 1) == '/') &&
							(i + 1 < n && j - 1 >= 0)) && (i+1 < n && s[i+1].charAt(j) =='|')&&
							(i+1 < n && j+1<m && s[i+1].charAt(j+1)=='\\')&&(i+2<n&&j-1>=0&&s[i+2].charAt(j-1)=='(')&&
							(i+2<n&&j+1<m&&s[i+2].charAt(j+1)==')'))
						sum ++;
				}
			}
			System.out.println(sum);
		}
	}
}
